<template>
  <div class="container row page">
    <div class="col-2 sidebar">
      <ul>
        <!-- 添加 click 事件到 li 元素 -->
        <li v-for="item in navList" :key="item.url" class="nav-item" @click="navigateTo(item.url)">
          <div>
            <img class="nav-icon" :src="item.icon" width="30" height="30" alt="sy" />
            <!-- 移除 router-link，改为文字直接展示 -->
            <span>{{item.title}}</span>
          </div>
        </li>
      </ul>
    </div>
    <div class="col-10">
      <div class="container page-main">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DoctorLayout',
  data() {
    return {
      navList: [
        { title: "患者管理", url: "/doctor/patient_management", icon: "/src/assets/pic/患者管理.png" },
        { title: "数据共计", url: "/doctor/patient_data_statistics", icon: "/src/assets/pic/患者管理.png" }
      ]
    }
  },
  methods: {
    // 跳转方法，使用 this.$router.push() 实现导航
    navigateTo(url) {
      this.$router.push(url);
    }
  }
}
</script>

<style scoped>
/* 样式保持不变 */
@import "/src/assets/bootstrap.min.css";

div.page{
  max-width: 1200px;
  margin: auto;
}
div.sidebar{
  padding-top: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 添加轻微阴影 */
  border-radius: 10px; /* 圆角 */
  border: none; /* 移除边框 */
  background-color: white; /* 白色背景 */
}
div.page-main{
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 添加轻微阴影 */
  border-radius: 10px; /* 圆角 */
  border: none; /* 移除边框 */
  background-color: white; /* 白色背景 */
}
div.sidebar ul{
  padding-left: 0;
}
div.sidebar li{
  list-style-type: none;
  margin-top: 10px;
  margin-bottom: 10px;
  cursor: pointer; /* 鼠标变为手势，提示可点击 */
}
div.sidebar li:hover{
  background-color: #FDF5E6;
}
div.sidebar a{
  text-decoration: none;
  color: #39475A;
  padding-left: 10px;
}
</style>
